import Vue from "vue";
import Router from 'vue-router'
import Main from '../views/Main'
import Login from '../views/Login'


import UserList from '../views/user/List'
import UserProfile from '../views/user/Profile'
import NotFound from "../views/NotFound";

Vue.use(Router);

export default new Router({
  mode:"history",
  routes:[
    {
      path:'/login',
      component:Login,

    },
    {
      path:'/main/:name',
      props:true,
      component:Main,//嵌套路由
      children:[
        {
          props:true,
          path:'/user/profile/:name',
          name:'UserProfile',
          component:UserProfile
        },
        {
          path:'/user/list',
          component:UserList
        }

      ]
    },
    {
      path:'/goHome',
      //重定向：redirect

      redirect:'/main'
    },
    {
      path:'*',
      component:NotFound
    }
  ]
});









